import {Component} from '@angular/core';
import {GnTableButton, GnTableComponent} from 'geminis-ng';

@Component({
  selector: 'everydata-category-table-button',
  template: `
    <button nz-button nzDanger [disabled]="!table?.isSelected" (click)="deleteData()">
      <i nz-icon nzIconfont="delete"></i>删除
    </button>
  `,
  styles: [':host{order: 210;}']
})
@GnTableButton('everydata-category')
export class CategoryTableButtonComponent {

  table!: GnTableComponent;

  deleteData(): void {
    this.table.deleteData(this.table.url, this.table.selected.map((row: any) => row.pathId));
  }

}
